import random
import time


print(random.random()) # 随机0-1之间的小数
print(random.randint(1,100)) # 随机指定范围的整数
alist = ["张三","李四","王五","赵六"]
print(random.choice(alist))
print(random.choices(alist,k=2))
# 洗牌
random.shuffle(alist)
print(alist)



# time模块
# 休眠函数
# time.sleep(5)
# print("-------------")
print(time.time()) # 获取当前时间时间戳
# 获取当前时间的时间元组
print(time.localtime())
# 时间元组和时间字符串类型的转换
str1 = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
print(str1)

str2 = "2008-08-08 12:00:00"
timeTuple = time.strptime(str2, "%Y-%m-%d %H:%M:%S")
print(timeTuple)


# 随机生成1-100之间的30个整数数，放到列表中，不允许重复.
resultList = []

while len(resultList)<30:
    i = random.randint(1,1000)
    if i not in resultList:
        resultList.append(i)


print(resultList)
print(len(resultList))